Skip to content

JuliaSyntax: Disallow broadcasted getindex#60277

Merged
Keno merged 1 commit intomasterfrom
claude/fix-julia-60270-01EYzgiKQppeZvcwnBEbwrAp
Mar 2, 2026
Merged

JuliaSyntax: Disallow broadcasted getindex#60277
Keno merged 1 commit intomasterfrom
claude/fix-julia-60270-01EYzgiKQppeZvcwnBEbwrAp

Conversation

@Keno
Copy link
Copy Markdown
Member

@Keno Keno commented Nov 28, 2025

The flisp parser rejects expressions like [1,2].[(1,2)] with a syntax error, but JuliaSyntax was allowing them to parse and then fail at runtime with a confusing MethodError about getproperty.

Note that in the flisp parser, this was allowed in the parser, but then disallowed in lowering. It's all a bit messy. My preference is to disallow this at the parser level for now and then introduce this as a proper feature with syntax evolution in the future. I don't think we want the production here to match what the flisp parser used to do. Given all those considerations, I think a syntax error is appropriate here for the moment.

Fixes #60270

@Keno Keno requested a review from mlechu November 28, 2025 20:41
@Keno Keno changed the title Fix Julia issue 60270 JuliaSyntax: Disallow broadcasted getindex Nov 28, 2025
Copy link
Copy Markdown
Member

@mlechu mlechu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests need fixing, but the change sounds OK

The flisp parser rejects expressions like `[1,2].[(1,2)]` with a syntax
error, but JuliaSyntax was allowing them to parse and then fail at
runtime with a confusing MethodError about getproperty.

This adds a check in `parse_call_chain` to emit a syntax error when
`[` or `{` follows `.`, matching the flisp parser's behavior. Parser
AST tests are added alongside the existing diagnostic tests, and the
test/syntax.jl tests are updated to use `@test_parseerror` now that
these are parse-time errors rather than lowering errors.

Fixes #60270

Co-Authored-By: Keno Fischer <keno@juliacomputing.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Keno Keno force-pushed the claude/fix-julia-60270-01EYzgiKQppeZvcwnBEbwrAp branch from 7f0bc80 to 5220a63 Compare March 2, 2026 06:03
@Keno Keno added the backport 1.13 Change should be backported to release-1.13 label Mar 2, 2026
@Keno Keno merged commit d848717 into master Mar 2, 2026
9 of 10 checks passed
@Keno Keno deleted the claude/fix-julia-60270-01EYzgiKQppeZvcwnBEbwrAp branch March 2, 2026 20:12
@KristofferC KristofferC mentioned this pull request Mar 3, 2026
56 tasks
@KristofferC KristofferC mentioned this pull request Mar 13, 2026
27 tasks
@KristofferC
Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport 1.13 Change should be backported to release-1.13

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JuliaSyntax does not reject broadcasted getindex

4 participants